$(document).ready(function(){
	document.onkeydown = function(e){
		//火狐中是 window.event
        if(!e) e = window.event;
        if((e.keyCode || e.which) == 13){
        	login();
        }
	};
	
});

/**
 * [登录]
 */
function login(){
	var name = $("#name").val();
	var password = $("#pwd").val();
	var token = $("#token").val();
	if(!name){
		alert("请输入登录凭证");
		return;
	}
	if(!password){
		alert("请输入登录密码");
		return;
	}
	$.ajax({
		type : "POST",
		url : path + "/user/validateLogin",
		data : {"token":token,"password":password,"name":name},
		dataType : "json",
		success : function(data) {
			if (data.invokeState == "SUCCESS") {
				console.log(path);
				window.location = path;
			} else {
				alert(data.result);
			}
		}
	});
}